﻿using PC.PickleJar.Trello.Domain;
using PC.PickleJar.Trello.Helpers;
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace PC.PickleJar.Trello.Data.Resources
{
	internal class CardByShortLinkResource : ResourceBase<TrelloCard>
	{
		private static readonly String RelativeUriFormat = "cards/{0}";

		private string shortLink;

		public CardByShortLinkResource(String shortLink, String developerApiKey, String userToken)
			: base(developerApiKey, userToken)
		{
			this.shortLink = new Uri(shortLink).Segments.Last();
		}

		public override String RelativeUri
		{
			get
			{
				return String.Format(
					CultureInfo.InvariantCulture,
					CardByShortLinkResource.RelativeUriFormat,
					this.shortLink);
			}
		}
	}
}
